package com.dys.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @className: com.dys.servlet.MyServlet01
 * @description: com.dys.servlet
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/09/19 20:08
 */
public class MyServlet01 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 1.响应行相关信息
        // resp.setStatus(500);
        // resp.setStatus(405,"不支持该方法......");
        // 2.相应头相关信息
        // resp.setHeader("aaa","2024-9-19");
        // resp.setHeader("content-type", "text/html;charset=utf-8");
        // 专门用于设置Content-Type 响应头
        resp.setContentType("text/html");
        // 3.响应体相关信息
        resp.getWriter().write("<h1>响应体</h1>");
    }
}
